<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="tpshop" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>{$goods.goods_name}_{$tpshop_config.shop_info_store_title}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/goods.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/layer.css"/>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script type="text/javascript" src="__STATIC__/js/jquery.json.js"></script>
<script type="text/javascript" src="__STATIC__/js/touchslider.dev.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js" ></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
<script src="__STATIC__/js/common.js"></script>
</head>
<body>
<script type="text/javascript">
var process_request = "正在处理您的请求...";
</script> 
<div class="main">
  <div class="tab_nav">
    <div class="header">
      <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
      <div class="h-mid">
        <ul>
          <li><a href="javascript:;" class="tab_head on"   id="goods_ka1" onClick="setGoodsTab('goods_ka',1,3)">商品</a></li>
          <li><a href="javascript:;" class="tab_head" id="goods_ka2" onClick="setGoodsTab('goods_ka',2,3)">详情</a></li>
          <li><a href="javascript:;" class="tab_head" id="goods_ka3" onClick="setGoodsTab('goods_ka',3,3)">评价</a></li>
        </ul>
      </div>
      <div class="h-right">
        <aside class="top_bar">
          <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a href="javascript:;"></a> </div>
          <a href="{:U('Mobile/Cart/cart')}" class="show_cart"><em class="global-nav__nav-shop-cart-num" id="tp_cart_info">{$cart_total_price[anum]}</em></a> 
         </aside>
      </div>
    </div>
  </div>
<include file="Public/menu"/> 
  <div class="main" id="user_goods_ka_1" style="display:block;">
<div class="banner">
  <div id="slider" class="slider" style="overflow: hidden; visibility: visible; list-style: none; position: relative;">
    <ul id="sliderlist" class="sliderlist" style="position: relative; overflow: hidden; transition: left 600ms ease; -webkit-transition: left 600ms ease;">
       <foreach  name="goods_images_list" item="pic">
      	<li style="float: left; display: block; width: 100%;"><span><a  href="javascript:void(0)">
      	<img title="" width="100%" src="{$pic.image_url}"></a></span></li>
       </foreach>
    </ul>
    <div id="pagenavi">
    <foreach  name="goods_images_list" item="pic" key="k">
    	<a href="javascript:void(0);" <if condition="$k eq 0">class="active"</if>></a>
     </foreach>
	</div>
  </div>
</div>
<div class="s_bottom"></div>
<script type="text/javascript">$(function(){
	$("div.module_special .wrap .major ul.list li:last-child").addClass("remove_bottom_line");
});
var active=0,
	as=document.getElementById('pagenavi').getElementsByTagName('a');
	
for(var i=0;i<as.length;i++){
	(function(){
		var j=i;
		as[i].onclick=function(){
			t2.slide(j);
			return false;
		}
	})();
}
var t2=new TouchSlider({id:'sliderlist', speed:600, timeout:6000, before:function(index){
		as[active].className='';
		active=index;
		as[active].className='active';
	}});
</script>
	  <form name="buy_goods_form" method="post" id="buy_goods_form" >
      <div class="product_info">
        <div class="info_dottm">
          <h3 class="name">{$goods.goods_name}</h3>
          <div class="right">

<!-- JiaThis Button BEGIN -->          
          <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt" target="_blank">
            <div id="pro_share" class="share"></div>
          </a>         
<script>
 var jiathis_config = {
						url:"http://{$_SERVER[HTTP_HOST]}/index.php?m=Mobile&c=Goods&a=goodsInfo&id={$_GET[id]}",
						pic:"http://{$_SERVER[HTTP_HOST]}{$goods[goods_id]|goods_thum_images=400,400}", 
					}
var is_distribut = getCookie('is_distribut');
var user_id = getCookie('user_id');
// 如果已经登录了, 并且是分销商
if(parseInt(is_distribut) == 1 && parseInt(user_id) > 0)
{									
	jiathis_config.url = jiathis_config.url + "&first_leader="+user_id;									
}										
//alert(jiathis_config.url);
</script>           
<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END -->          
          
          </div>
        </div>
        <dl class="goods_price">
          <script type="text/javascript" src="__STATIC__/js/lefttime.js"></script>
          <dt> <span id="goods_price">￥{$goods.shop_price}元</span><font>价格：￥{$goods.market_price}元</font> </dt>
        </dl>
        <ul class="price_dottm">
          <li style=" text-align:left">折扣：{$goods.discount}折</li>
          <li>{$commentStatistics.c0}人评价</li>
          <li style=" text-align:right">{$goods.sale_num}人已付款</li>
        </ul>
      </div>
<if condition="($prom_goods neq null) OR ($prom_order neq null)">      
      <section id="search_ka" class="huodong">
	      <div class="subNav">
	        <div class="att_title"> <span>惠</span>
	          <p>促销活动</p>
	        </div>
	      </div>
	      <div class="navContent">
          <if condition="$prom_goods neq null">
              <ul class="youhui_list1">
                <li>
                <a href="javascript:void(0);" title="{$prom_goods[name]}"><img src="__STATIC__/images/hui.png"></a> 
                <a href="javascript:void(0);" >{$prom_goods[name]}&nbsp;&nbsp;(活动时间：{$prom_goods[start_time]|date="m月d日",###} - {$prom_goods[end_time]|date="m月d日",###})</a>
                </li>
              </ul>
          </if>
		<tpshop sql="select * from `__PREFIX__prom_order` order by  id desc limit 5" item="v" key="k" >              
	      <ul class="youhui_list1" style="margin-top:0px;">
	      	<li><img src="__STATIC__/images/hui.png">{$v['name']}&nbsp;&nbsp;(活动时间：{$v[start_time]|date="m月d日",###} - {$v[end_time]|date="m月d日",###})</li>
	      </ul>
		</tpshop>          
	      <div class="blank10"></div>
	      </div>
      </section>
</if>      
<!-------商品属性-------->
<if condition="$filter_spec neq ''">  
<section id="search_ka">
<!---属性---->
<div class="ui-sx bian1" style="display: none">
<div class="subNavBox"> 
	<div class="subNav"><strong>选择商品属性</strong></div>
    <ul class="navContent"> 
    <foreach item="spec" key="key" name="filter_spec">
    <li>   
          <div class="title">{$key}</div>
          <div class="item">
          <foreach name="spec" item="v2" key="k2">
	          <a href="javascript:;" onclick="switch_spec(this);" title="{$v2[item]}" <if condition="$k2 eq 0">class="hover"</if>>
	          	<input type="radio" style="display:none;" name="goods_spec[{$key}]" value="{$v2[item_id]}" <if condition="$k2 eq 0 ">checked="checked"</if>/>
          		{$v2[item]}            
          	  </a>
           </foreach>
          </div>                    
    </li>
    </foreach>
       </ul>  
    </div>
    </div>    
</section> 
</if>
      <section id="search_ka" style="display: none">
        <div class="ui-sx bian1">
          <div class="subNavBox">
            <div class="subNav on"><strong>购买数量</strong></div>
            <ul class="navContent" style="display: block;">
              <li style=" border-bottom:1px solid #eeeeee">
                <div class="item1"> 
                  <span class="ui-number">
                  <button type="button" class="decrease" onClick="goods_cut();">-</button>
                    <input type="text" class="num" id="number" name="goods_num" value="1" min="1" max="1000"/>
                    <input type="hidden" name="goods_id" value="{$goods.goods_id}"/>
                  <button type="button" class="increase" onClick="goods_add();">+</button>
                  </span> </div>
              </li>
            </ul>
          </div>
        </div>
      </section>
      <section id="search_ka" style="display: none">
        <div class="ui-sx bian1">
          <div class="subNavBox" >
            <div class="subNav"><strong>会员专享价</strong></a></div>
            <ul class="navContent" >
              <li  class="user_price">
                <p> <span class="key">铜牌会员：</span> <b class="p-price-v">9.8折</b> </p>
                <p> <span class="key">金牌会员：</span> <b class="p-price-v">9.5折</b> </p>
                <p> <span class="key">钻石会员：</span> <b class="p-price-v">9折</b> </p>
              </li>
            </ul>
          </div>
        </div>
      </section>
<script type="text/javascript">
$(function(){
	$(".subNav").click(function(){		
		$(this).next(".navContent").slideToggle(300).siblings(".navContent").slideUp(500);
		$(this).toggleClass("on").siblings(".subNav").removeClass("on");
		if($(".is_scroll").length <= 0)
		{
			$('html,body').animate({'scrollTop':$('body')[0].scrollHeight},600);
		}
	});
	commentType = 1; // 评论类型
    ajaxComment(1,1);// ajax 加载评价列表
})
</script> 
<script type="text/jscript">
function click_search (){
  var search_ka = document.getElementById("search_ka");
  	if (search_ka.className == "s-buy open ui-section-box"){
	  	search_ka.className = "s-buy ui-section-box";
	}else {
		search_ka.className = "s-buy open ui-section-box";
	}
}
 
function changeAtt(t) {
	t.lastChild.checked='checked';
	for (var i = 0; i<t.parentNode.childNodes.length;i++) {
	    if (t.parentNode.childNodes[i].className == 'hover') {
	        t.parentNode.childNodes[i].className = '';
			t.childNodes[0].checked="checked";
		}
	}
	t.className = "hover";
	changePrice();
}

function changeAtt1(t) {
	t.lastChild.checked='checked';
	for (var i = 0; i<t.parentNode.childNodes.length;i++) {
	    if (t.className == 'hover') {
	           t.className = '';
			t.childNodes[0].checked = false;
		}
		else{
			t.className="hover";
			t.childNodes[0].checked = true;
		}
	}
	changePrice();
}

	function goods_cut(){
  		var num_val=document.getElementById('number');  
  		var new_num=num_val.value;  
  		var Num = parseInt(new_num);  
  		if(Num>1)Num=Num-1;  
  		num_val.value=Num;
  	}  
  	function goods_add(){
  		var num_val=document.getElementById('number'); 
  		var new_num=num_val.value;  
  		var Num = parseInt(new_num);  
  		Num=Num+1;  num_val.value=Num;
  	} 
</script>
      <div style=" height:8px; background:#eeeeee; margin-top:-1px;"></div>
      <!--
      <div class="is_scroll">
        <section id="search_ka">
          <div class="ui-sx bian1">
            <div class="subNavBox" >
              <div class="subNav" style=" border:0;"><a href="pocking.php?id=22" style=" border:0px;"><strong>自提点</strong></a></div>
            </div>
          </div>
        </section>
      </div>
      -->
      <if condition="$goods[store_id] gt 0">
      <div class="is_scroll" style="display: none">
        <input type="hidden" id="chat_supp_id" value="1" />
        <div style=" height:8px; background:#eeeeee; margin-top:-1px;"></div>
        <section class="rzs_info">
          <div class="top_info">
            <dl>
              <dt><a href="{:U('Store/index',array('store_id'=>$store[store_id]))}">
                <div style="background-image:url('{$store.store_logo}')"></div>
                </a></dt>
              <dd><strong>卖家: <a href="{:U('Store/index',array('store_id'=>$store[store_id]))}" style="color:#333; font-size:18px;">{$store.store_name}</a></strong><em>初级店铺</em></dd>
            </dl>
            <ul>
              <li><span>宝贝描述</span><strong>:{$store.store_desccredit}</strong><em>高</em></li>
              <li><span>卖家服务</span><strong>:{$store.store_servicecredit}</strong><em>高</em></li>
              <li><span>物流服务</span><strong>:{$store.store_deliverycredit}</strong><em>高</em></li>
            </ul>
          </div>
          <div class="s_dianpu"> <span><a href="tel:{$store.store_phone}" style=" margin-left:7%;"><em class="bg1"></em>联系客服</a></span> 
          <span><a href="{:U('Store/index',array('store_id'=>$store[store_id]))}" style=" margin-left:3%;"><em class="bg2"></em>进入店铺</a></span> </div>
        </section>
      </div>
      </if>
    </form>
  </div>
  <div class="main" id="user_goods_ka_2" style="display:none">
    <div class="product_main" style=" margin-top:40px;"> <!-- 产品图片 -->
         <div class="product_images product_desc" id="product_desc"> {$goods.goods_content|htmlspecialchars_decode} </div>
    </div>
    <section class="index_floor">
      <h2 style=" border-bottom:1px solid #ddd "> <span></span> 商品信息 </h2>
        <ul class="xiangq">
           <foreach name="goods_attr_list" item="v" key="k" >
           <li><p>{$goods_attribute[$v[attr_id]]}:</p><span>{$v[attr_value]}</span></li>
           </foreach>
           <li><p>上架时间：</p><span>{$goods.on_time|date='Y-m-d H:i',###}</span></li>
           <li></li>
        </ul>
    </section>
  </div>
  <div class="tab_attrs tab_item hide" id="user_goods_ka_3" style="display:none;"> 

<div id="ECS_COMMENT">
<link href="__STATIC__/css/photoswipe.css" rel="stylesheet" type="text/css">
<script src="__STATIC__/js/klass.min.js"></script> 
<script src="__STATIC__/js/photoswipe.js"></script>
    <div class="comment_littlenav">
        <ul id="fy-comment-list">
            <li class="com-red" data-id="1">全部评论<br/>({$commentStatistics['c0']})</li>
            <li data-id="2">好评<br/>({$commentStatistics['c1']})</li>
            <li data-id="3">中评<br/>({$commentStatistics['c2']})</li>
            <li data-id="4">差评<br/>({$commentStatistics['c3']})</li>
            <li data-id="5">晒单<br/>({$commentStatistics['c4']})</li>
        </ul>
    </div>
<div class="my_comment_list" id="ECS_MYCOMMENTS"> </div>

</div>
 	</div>
</div>
<script>
function goTop(){
	$('html,body').animate({'scrollTop':0},600);
}
</script> 
<a href="javascript:goTop();" class="gotop"><img src="__STATIC__/images/topup.png"></a>
<div style=" height:60px;"></div>
<div class="footer_nav">
  <ul>
    <li class="bian"><a href="{:U('Index/index')}"><em class="goods_nav1"></em><span>首页</span></a> </li>
    <!--<li class="bian"><a href="tel:{$tpshop_config['shop_info_phone']}"><em class="goods_nav2"></em><span>客服</span></a> </li>-->
    <li><a href="javascript:collect_goods({$goods.goods_id})" id="favorite_add"><em class="goods_nav3"></em><span>收藏</span></a></li>
  </ul>
  <dl>
    <dd class="flow"><a class="button active_button" href="javascript:void(0);" onClick="AjaxAddCart({$goods.goods_id},1,0);">加入购物车</a> </dd>
    <dd class="goumai"><a style="display:block;" href="javascript:void(0);"  onclick="AjaxAddCart({$goods.goods_id},1,1);">立即购买</a> </dd>
  </dl>
</div>
<script type="text/javascript">
$(document).ready(function(){	
	// 更新商品价格
	get_goods_price();
});


function switch_spec(spec)
{
    $(spec).siblings().removeClass('hover');
    $(spec).addClass('hover');
	$(spec).siblings().children('input').prop('checked',false);
	$(spec).children('input').prop('checked',true);	
    //更新商品价格
    get_goods_price();
}

function get_goods_price()
{
	var goods_price = {$goods.shop_price}; // 商品起始价
	var store_count = {$goods.store_count}; // 商品起始库存	
	var spec_goods_price = {$spec_goods_price};  // 规格 对应 价格 库存表   //alert(spec_goods_price['28_100']['price']);	
	// 如果有属性选择项
	if(spec_goods_price != null)
	{
		goods_spec_arr = new Array();
		$("input[name^='goods_spec']:checked").each(function(){
			 goods_spec_arr.push($(this).val());
		});    
		var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序后组合成 key	
		goods_price = spec_goods_price[spec_key]['price']; // 找到对应规格的价格		
		store_count = spec_goods_price[spec_key]['store_count']; // 找到对应规格的库存
	}
	var goods_num = parseInt($("#goods_num").val()); 
	// 库存不足的情况
	if(goods_num > store_count)
	{
	   goods_num = store_count;
	   alert('库存仅剩 '+store_count+' 件');
	   $("#goods_num").val(goods_num);
	}
    var flash_sale_price = parseFloat("{$goods['flash_sale']['price']}");
    (flash_sale_price > 0) && (goods_price = flash_sale_price);
	$("#goods_price").html('￥'+goods_price+'元'); // 变动价格显示

}

function sortNumber(a,b) 
{ 
	return a - b; 
}

// 好评差评 切换
$("#fy-comment-list").children().each(function(i,o){
    $(o).click(function(){
        $(o).siblings().removeClass('com-red');
        $(o).addClass('com-red');
        commentType = $(o).data('id');// 评价类型   好评 中评  差评
        ajaxComment(commentType,1);
    });
});

function ajaxComment(commentType,page){
    $.ajax({
        type : "GET",
        url:"/index.php?m=Mobile&c=goods&a=ajaxComment&goods_id={$goods['goods_id']}&commentType="+commentType+"&p="+page,//+tab,
        success: function(data){
            $(".my_comment_list").empty().append(data);
            var myPhotoSwipe = $("#gallery a").photoSwipe({ 
        		enableMouseWheel: false, 
        		enableKeyboard: false, 
        		allowUserZoom: false, 
        		loop:false
        	});
        }
    });
}

$(document).ready(function(){
	  var cart_cn = getCookie('cn');
	  if(cart_cn == ''){
		$.ajax({
			type : "GET",
			url:"/index.php?m=Home&c=Cart&a=header_cart_list",//+tab,
			success: function(data){								 
				cart_cn = getCookie('cn');						
			}
		});	
	  }
	  $('#tp_cart_info').html(cart_cn);
});
</script>
<script src="__PUBLIC__/js/jqueryUrlGet.js"></script><!--获取get参数插件-->
<script> set_first_leader(); //设置推荐人 </script>
<!-- 微信浏览器 调用微信 分享js-->
<if condition="$signPackage neq null">
	<include file="Public/wx_share"/>
</if>
<!-- 微信浏览器 调用微信 分享js  end-->
</body>
</html>